package com.groupfour.attendancemanagementsystem.dao;

import com.groupfour.attendancemanagementsystem.entity.DO.StudentDO;
import com.groupfour.attendancemanagementsystem.entity.DTO.CRUStudentDTO;
import com.groupfour.attendancemanagementsystem.entity.DTO.PersonalGroupMemberDTO;
import com.groupfour.attendancemanagementsystem.entity.DTO.PersonalInformationDTO;
import com.groupfour.attendancemanagementsystem.entity.VO.GroupRankingVO;
import com.groupfour.attendancemanagementsystem.entity.VO.PersonalGroupMemberVO;
import com.groupfour.attendancemanagementsystem.entity.VO.ProjectScoreVO;
import com.groupfour.attendancemanagementsystem.entity.VO.RStudentVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.sql.Timestamp;
import java.util.List;

@Mapper
public interface StudentDao {

    /**
     * @author 卑微小峰
     * @param userCode
     * @return int
     * @describe 获取学生登录信息
     */
    StudentDO getStudentByStudentCode(@Param("userCode")String userCode);

    /**
     * @author 卑微小峰
     * @param newPwd,userCode
     * @return int
     * @describe 学生修改自己的密码
     */
    int updatePassword(@Param("newPwd")String newPwd, @Param("userCode")String userCode);



    /**
     * @author 扶永超
     * @param cruStudentVO,studentPassword,classesCode
     * @return int
     * @describe 添加学生信息
     */
    int addStudent(@Param("cruStudentDTO") CRUStudentDTO cruStudentVO, @Param("studentPassword")String studentPassword);

    /**
     * @author 扶永超
     * @param studentCode
     * @return int
     * @describe 删除学生信息（逻辑删）
     */
    int deleteStudent(@Param("studentCode")String studentCode);

    /**
     * @author 扶永超
     * @param cruStudentDTO
     * @return int
     * @describe 修改学生信息
     */
    int updateStudent(@Param("cruStudentDTO")CRUStudentDTO cruStudentDTO,@Param("studentCode")String studentCode, @Param("updateTime")Timestamp updateTime);

    /**
     * @author 扶永超
     * @param cruStudentDTO,classesCode
     * @return List<RStudentDTO>
     * @describe 查询指定班级学生信息
     */
    List<RStudentVO> selectStudent(CRUStudentDTO cruStudentDTO);

    /**
     * @author 卑微小峰
     * @param userCode
     * @return PersonalGroupMemberDTO
     * @describe 获取个人信息
     */
    PersonalInformationDTO getPersonalInformation(@Param("userCode")String userCode);

    /**
     * @author 卑微小峰
     * @param newPhone,userCode
     * @return int
     * @describe 修改个人手机号码
     */
    int updateStudentPhone(@Param("newPhone")String newPhone,@Param("userCode")String userCode);

    /**
     * @author 卑微小峰
     * @param newIdentity,userCode
     * @return int
     * @describe 修改个人身份证号码
     */
    int updateStudentIdentity(@Param("newIdentity")String newIdentity,@Param("userCode")String userCode);

    /**
     * @author
     * @param
     * @return int
     * @describe 修改个人头像
     */
//    int updateStudentPhoto();

    /**
     * @author 章珑赢
     * @param userCode
     * @return List<PersonalGroupMemberDTO>
     * @describe 根据学生学号查询项目编号和小组编号
     */
    List<PersonalGroupMemberDTO> selectGroupCodeAndCourseCode(@Param("userCode") String userCode);

    /**
     * @author 章珑赢
     * @param personalGroupMemberDTOS
     * @return List<PersonalGroupMemberVO>
     * @describe 查询小组成员信息
     */
    List<PersonalGroupMemberVO> selectGroupMember(List<PersonalGroupMemberDTO> personalGroupMemberDTOS);

    /**
     * @author 章珑赢
     * @param personalGroupMemberDTOS
     * @return List<ProjectScoreVO>
     * @describe 查询小组得分
     */
    List<ProjectScoreVO> selectProjectScore(List<PersonalGroupMemberDTO> personalGroupMemberDTOS);

    /**
     * @author 章珑赢
     * @param courseCode
     * @return List<GroupRankingVO>
     * @describe 查询小组排名
     */
    List<GroupRankingVO> selectRanking( @Param("courseCode") String courseCode);

    int updatePhoto(@Param("savePath") String savePath,@Param("userCode") String userCode);
}
